<?php
/*
# ------------------------------------------------------------------------
# JA Job Board Package
# ------------------------------------------------------------------------
# Copyright (C) 2004-2010 JoomlArt.com. All Rights Reserved.
# @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
# Author: JoomlArt.com
# Websites: http://www.joomlart.com - http://www.joomlancers.com.
# ------------------------------------------------------------------------
*/
  defined('_JEXEC') or die('Retricted Access');
?>
<script type="text/javascript">
	function checkAll_permission(count)
	{
		var check = false;
		toggle = document.getElementById('toggle');
		if( toggle.checked==true )
		{
			check = true;
		}
		for(var i=0;i<count;i++)
		{
			id='cb'+i;
			cb = document.getElementById(id);
			cb.checked = check;
		}	
	}
</script>
<form name="adminForm" action="index.php" method="post">
    <table width="100%">
    	
		<tr>
	
		<td width="100%" valign="top">
			<div style="width:100%;">
				
				<?php echo $this->menu_Group();?>
				<br/>
				
				<div style="width:100%; text-align:center"><?php  echo $this->lists['group'];?></div>
				
				<fieldset>
				<legend><?php echo JText::_('Edit Permission'); ?></legend>
					<table class="adminlist">
						<thead>
							
							<tr>
								<th width="10%" align="left">
									<?php echo JText::_( 'NUM' ); ?>
								</th>
								<th width="5%" align="center">
									<input type="checkbox" name="toggle" id='toggle' value=""  onclick="checkAll_permission(<?php echo count( $this->rows[0]); ?>);" />
								</th>		
								<th width="85%"><?php echo JText::_('Name function') ?></th>
							</tr>
						</thead>
						<tbody>
							<?php
								
								$rows = $this->rows;
								if($rows)
								{
									foreach ($rows[0] as $k=>$per){
										?>
											<tr class="<?php echo "row$k"; ?>">		
												<td align="center">
													<?php echo $k+1; ?>
												</td>						
												<td align="center">
													<input type="checkbox" id='cb<?php echo $k;?>' name="cb[]" <?php if($rows[1][$k]>0)echo 'checked';?> value="<?php echo $per->value;?>">
												</td>	
												<td>
													<?php echo $per->text;?>
												</td>															
											</tr>
										<?php
									
									}
								}
							?>
						</tbody>
					</table>
			    </fieldset>    
			</div>
		</td>
	</tr>
	</table>
	<input type="hidden" name="cid" value="<?php echo $this->cid; ?>" />
	<input type="hidden" name="group_per" value="<?php echo $this->group_per; ?>" />
	<input type="hidden" name="usergroup" value="<?php echo $this->usergroup; ?>" />
	<input type="hidden" name="option" value="<?php echo $this->option; ?>" />
	<input type="hidden" name="view" value="japermission" />
	<input type="hidden" name="task" value="bygroup" />
	<?php echo JHTML::_( 'form.token' ); ?>	
 </form>